[SPARK-15711][SQL] Ban CREATE TEMPORARY TABLE USING AS SELECT#13451
[SPARK-15711][SQL] Ban CREATE TEMPORARY TABLE USING AS SELECT#13451clockfly wants to merge 3 commits intoapache:masterfrom
Conversation
e48caf0 to
fa1db6a
Compare
|
Looks good. Can you add a test for the new exception that you throw? |
|
Test build #59770 has finished for PR 13451 at commit
|
|
Test build #59776 has finished for PR 13451 at commit
|
There was a problem hiding this comment.
Can you move this test case to HiveDDLCommandSuite, which contains the Hive-specific parser test cases? You also can see the other CTAS test cases there. Thanks!
There was a problem hiding this comment.
@gatorsmile Thanks. The test should be included in CreateTableAsSelectSuite
HiveDDLCommandSuite contains "create table as select", CreateTableAsSelectSuite contains "create table ... using ... as select ..."
There was a problem hiding this comment.
Normally, parser-specific test cases are put in the same suite. I am fine if you put it to the CTAS-specific test suite, especially when we will support it in the near future.
b7bb43d to
90fb80a
Compare
90fb80a to
2f0355f
Compare
|
|
||
| checkAnswer( | ||
| sql("SELECT a, b FROM jsonTable"), | ||
| sql("SELECT a, b FROM jt").collect()) |
There was a problem hiding this comment.
Nit: you do not need to call collect
|
LGTM except some minor issues which are already pointed out by others. |
|
Thanks @gatorsmile |
|
LGTM. Thanks! |
|
Test build #59818 has finished for PR 13451 at commit
|
|
Test build #59822 has finished for PR 13451 at commit
|
|
Test build #59828 has finished for PR 13451 at commit
|
|
Test build #59830 has finished for PR 13451 at commit
|
|
Test build #59834 has finished for PR 13451 at commit
|
| // Get the backing query. | ||
| val query = plan(ctx.query) | ||
|
|
||
| if (temp) { |
There was a problem hiding this comment.
nit: can you please rename this to temporary
There was a problem hiding this comment.
Probably not in the scope of this PR, temp is a existing variable defined at https://github.com/clockfly/spark/blob/aaca7f01882de19c9dda47500f7d4f03712d3383/sql/core/src/main/scala/org/apache/spark/sql/execution/SparkSqlParser.scala#L304.
|
@andrewor14 Could you please help sign off this one? Thanks! |
|
LGTM! |
|
Merging into amster 2.0 |
## What changes were proposed in this pull request? This PR bans syntax like `CREATE TEMPORARY TABLE USING AS SELECT` `CREATE TEMPORARY TABLE ... USING ... AS ...` is not properly implemented, the temporary data is not cleaned up when the session exits. Before a full fix, we probably should ban this syntax. This PR only impact syntax like `CREATE TEMPORARY TABLE ... USING ... AS ...`. Other syntax like `CREATE TEMPORARY TABLE .. USING ...` and `CREATE TABLE ... USING ...` are not impacted. ## How was this patch tested? Unit test. Author: Sean Zhong <seanzhong@databricks.com> Closes #13451 from clockfly/ban_create_temp_table_using_as. (cherry picked from commit d109a1b) Signed-off-by: Andrew Or <andrew@databricks.com>
What changes were proposed in this pull request?
This PR bans syntax like
CREATE TEMPORARY TABLE USING AS SELECTCREATE TEMPORARY TABLE ... USING ... AS ...is not properly implemented, the temporary data is not cleaned up when the session exits. Before a full fix, we probably should ban this syntax.This PR only impact syntax like
CREATE TEMPORARY TABLE ... USING ... AS ....Other syntax like
CREATE TEMPORARY TABLE .. USING ...andCREATE TABLE ... USING ...are not impacted.How was this patch tested?
Unit test.